<template>
  <div>
    <!-- 通知条 -->
    <van-notice-bar
      mode="closeable"
      left-icon="volume-o"
      text="本app现已开放内测，欢迎大家注册使用！"
    />

    <!-- 中心部分 -->
    <div class="content">
      <div class="box">
        <div class="card" v-for="item in plays" :key="item.id">
          <router-link :to="`/detail/${item.id}`">
            <img :src="`/other/pic/${item.imga.split(',')[0]}`" alt="" />
            <div class="pdown">
              <div class="title">{{ item.title }}</div>
            </div>
            <div class="time_rate">
              <div class="time" v-if="item.updatetime">
                {{
                  item.updatetime.slice(0, 10) +
                  " " +
                  item.updatetime.slice(12, 19)
                }}
              </div>
              <div class="rate">
                {{ item.rate }}<van-icon name="star-o" color="#f5b400" />
              </div>
            </div>
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      plays: [],
    };
  },
  activated() {
    this.getData();
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      let city = sessionStorage.getItem("city");
      let url = `/recommend/around_city?type_id=3&city=${city}`;
      this.axios.get(url).then((res) => {
        this.plays = res.data.results;
      });
    },
  },
};
</script>
<style lang='scss' scoped>
.pdown {
  padding: 5px 4px;
}
.time_rate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px 4px;
  .time {
    color: #bbb;
    font-size: 12px;

    line-height: 22px;
  }
  .rate {
    text-align: right;
    font-size: 14px;
    margin-right: 6px;
    color: #222;
    p {
      text-align: right;
      font-size: 14px;
      margin: 4px 0;
    }
  }
}

/*顶部导航栏 */
::v-deep .van-nav-bar__text {
  color: white;
}
::v-deep .van-icon {
  color: white;
}

.van-nav-bar__left span {
  color: white;
}
.van-nav-bar {
  background-color: #f5b400;
}
.van-nav-bar .van-icon {
  color: white;
}
::v-deep .van-nav-bar__title {
  color: white;
}

.van-nav-bar__text {
  color: white;
}
.content {
  margin: 250px auto 70px !important;
}
// .content{
//   width: 100vw;
//   margin: 230px auto 30px;
//   border-radius: 20px;
//   padding: 10px 0;
//   background-color: #fff;
//   display: flex;
//   justify-content: center;
//   .box{
//     width: 100vw;
//     display: flex;
//     justify-content: space-around;
//     flex-wrap: wrap;
//     margin: 10px 0;
//   }

//   .card{
//   width: 44%;
//   margin: 10px;
//   overflow: hidden;
//   background-color: white;
//   break-inside: avoid;
//   border-radius: 10px;
//   // box-shadow: 1vw 1vw 1vw 0 #eee;
//       img {
//         display: block;
//         width: 100%;
//         margin: 0 auto;
//         border-radius: 10px;
//         position: relative;
//       }
//       .pdown {
//         display: flex;
//         flex-direction: column;
//         flex-wrap: wrap;
//         justify-content: center;
//         align-items: center;
//         .title{
//           width: 90%;
//           text-align: center;
//           font-size:16px;
//           font-weight: bold;
//           color: #333;
//           padding: 10px 10px 0 10px;
//           overflow: hidden;
//           white-space: nowrap;
//           text-overflow: ellipsis;
//           word-break: break-all;
//         }
//         .rate{
//           font-size:16px;
//           color: #666;
//           padding: 10px;
//         }
//         }
//       }
//     }
</style>
<style lang='scss' src='./waterfall.scss' scoped></style>
